//package com.fecean.aabbc.netty.client.prod1;
//
//import io.netty.bootstrap.Bootstrap;
//import io.netty.channel.ChannelFuture;
//import io.netty.util.Timeout;
//import io.netty.util.TimerTask;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//
///**
// * NettyClientTimerTask
// *
// * @author: chenfenghai
// * @version: 1.0
// * @date: 2020-03-05 16:57
// * @blame Team
// */
//@Slf4j
//@Component
//public class NettyClientTimerTask implements TimerTask {
//
//    @Autowired
//    NettyClientConnector nettyClientConnector;
//
//    @Resource
//    NettyClientSocketChannelInitializer nettyClientSocketChannelInitializer;
//
//    @Resource
//    NettyClientChannelFutureListener nettyClientChannelFutureListener;
//
//    @Autowired
//    Bootstrap bootstrap;
//
//    @Override
//    public void run(Timeout timeout) throws Exception {
//        try {
//            bootstrap.handler(nettyClientSocketChannelInitializer);
//            ChannelFuture future = bootstrap.connect("127.0.0.1", 8090).sync();
//            future.addListener(nettyClientChannelFutureListener);
//            future.channel().closeFuture().sync();
//        } catch (Exception e) {
//            log.error("服务器端已经断开，等待重新连接...");
//            nettyClientConnector.restart(5L);
//        }
//    }
//}
